from pydantic import BaseModel
from typing import Optional, Any

OPTIONAL_KEY = "optional"
REQUIRED_KEY = "required"

STYLE_TEXT = 'text'
STYLE_SELECT = 'select'
STYLE_CHECKBOX = 'checkbox'


class FieldInfo(BaseModel):
    """
    Represents information about a field in a data structure.

    Attributes:
        name (str): The name of the field.
        type (str): The data type of the field.
        optional_field (str): Indicates whether the field is optional or required.
        default_val (Optional[Any]): The default value of the field, if any.
        description (Optional[str]): A description of the field.
        style (Optional[str]): Style for user input in web. (text、select、checkbox...)
        option_data: (Optional[Any]): Data when style is select or checkbox
    """
    name: str 
    type: str
    optional_field: str
    default_val: Optional[Any] = None
    description: Optional[str] = ""
    style: Optional[str] = STYLE_TEXT
    option_data: Optional[Any] = None
